import Taro from '@tarojs/taro'
import {baseUrl} from '../constants/url'

export const getBlog = (blog_id,user_id) => {
  const result = Taro.request({
    url:baseUrl+'api/blog/find',
    method:'GET',
    data:{
      blog_id:blog_id!=undefined?blog_id:'',
      user_id:user_id!=undefined?user_id:'',
    }
  })
  return result
}

export const getBlogByTitle = (title) => {
  const result = Taro.request({
    url:baseUrl+'api/blog/findByTitle',
    method:'GET',
    data:{
      title
    }
  })
  return result
}

export const CreateBlog = (title,content,user_id) => {
  const result = Taro.request({
    url:baseUrl+'api/blog/create',
    method:'POST',
    data:{title,content,user_id}
  })
  return result
}

export const getBanner = () => {
  const result = Taro.request({
    url:baseUrl+'api/banner/find',
    method:'GET',
  })
  return result
}